package com.ruoyi.project.tencent.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.tencent.domain.TcDriversLicense;
import com.ruoyi.project.tencent.service.ITcDriversLicenseService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 腾讯云-用户驾驶证信息Controller
 * 
 * @author ruoyi
 * @date 2020-06-08
 */
@RestController
@RequestMapping("/tc/driverslicense")
public class TcDriversLicenseController extends BaseController
{
    @Autowired
    private ITcDriversLicenseService tcDriversLicenseService;

    /**
     * 查询腾讯云-用户驾驶证信息列表
     */
    @PreAuthorize("@ss.hasPermi('tc:driverslicense:list')")
    @GetMapping("/list")
    public TableDataInfo list(TcDriversLicense tcDriversLicense)
    {
        startPage();
        List<TcDriversLicense> list = tcDriversLicenseService.selectTcDriversLicenseList(tcDriversLicense);
        return getDataTable(list);
    }

    /**
     * 导出腾讯云-用户驾驶证信息列表
     */
    @PreAuthorize("@ss.hasPermi('tc:driverslicense:export')")
    @Log(title = "腾讯云-用户驾驶证信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TcDriversLicense tcDriversLicense)
    {
        List<TcDriversLicense> list = tcDriversLicenseService.selectTcDriversLicenseList(tcDriversLicense);
        ExcelUtil<TcDriversLicense> util = new ExcelUtil<TcDriversLicense>(TcDriversLicense.class);
        return util.exportExcel(list, "driverslicense");
    }

    /**
     * 获取腾讯云-用户驾驶证信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('tc:driverslicense:query')")
    @GetMapping(value = "/{dlid}")
    public AjaxResult getInfo(@PathVariable("dlid") Long dlid)
    {
        return AjaxResult.success(tcDriversLicenseService.selectTcDriversLicenseById(dlid));
    }

    /**
     * 新增腾讯云-用户驾驶证信息
     */
    @PreAuthorize("@ss.hasPermi('tc:driverslicense:add')")
    @Log(title = "腾讯云-用户驾驶证信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TcDriversLicense tcDriversLicense)
    {
        return toAjax(tcDriversLicenseService.insertTcDriversLicense(tcDriversLicense));
    }

    /**
     * 修改腾讯云-用户驾驶证信息
     */
    @PreAuthorize("@ss.hasPermi('tc:driverslicense:edit')")
    @Log(title = "腾讯云-用户驾驶证信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TcDriversLicense tcDriversLicense)
    {
        return toAjax(tcDriversLicenseService.updateTcDriversLicense(tcDriversLicense));
    }

    /**
     * 删除腾讯云-用户驾驶证信息
     */
    @PreAuthorize("@ss.hasPermi('tc:driverslicense:remove')")
    @Log(title = "腾讯云-用户驾驶证信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dlids}")
    public AjaxResult remove(@PathVariable Long[] dlids)
    {
        return toAjax(tcDriversLicenseService.deleteTcDriversLicenseByIds(dlids));
    }
}
